#include <stdio.h>  
#include <stdlib.h>  
#define size 2005  
#define INIT 2147483646  
  
int cmp(const void *a,const void *b)  
{  
    return *(int *)a-*(int *)b;  
}  
  
int Min(int a,int b)  
{  
    return a<b?a:b;  
}  
  
int dp[size][1005];  
  
int main()  
{  
    int n,k,i,j;  
    int val[size] = {0};  
    dp[0][0] = 0;  
    while (scanf("%d%d",&n,&k)!=EOF)  
    {  
        val[0] = 0;  
        for(i=1;i<=n;i++)  
            scanf("%d",&val[i]);  
        qsort(val+1,n,sizeof(val[0]),cmp);  
        for (i=0;i<=n;i++)  
        {  
            for(j=1;j<=k;j++)  
                dp[i][j] = INIT;  
        }  
        for (i=2;i<=n;i++)  
        {  
            for (j=1;j*2<=i;j++)  
                dp[i][j] = Min(dp[i-2][j-1]+(val[i]-val[i-1])*(val[i]-val[i-1]),dp[i-1][j]);  
        }  
        printf("%d/n",dp[n][k]);  
    }  
    return 0;  
} 	
